package no19.enum1;
/**
 * enum 应用于switch
 * @author gao
 *
 */
enum Signal{
	GREEN,YEEOW,RED
}

public class SwitchEnum {
	Signal color = Signal.RED;
	public  void change() {
		//switch只支持 int,char,enum
		switch(color){
		case RED: color = Signal.GREEN;break;
		case GREEN:color = Signal.YEEOW;break; 
		case YEEOW:color = Signal.RED;break; 
		}
	}
	
	public void print(){
		System.out.println("The color :"+color);
	}
	
	public static void main(String[] args) {
		SwitchEnum te = new SwitchEnum();
		for (int i = 0; i < 7; i++) {
			te.change();
			te.print();
		}
	}
	
}
